package problems.solved;

import java.util.Calendar;

public class Problem19 {
	public static void main(String[] args) {
		Calendar calendar = Calendar.getInstance();
		calendar.set(Calendar.YEAR, 1901);
		calendar.set(Calendar.MONTH, Calendar.JANUARY);
		calendar.set(Calendar.DAY_OF_MONTH, 1);
		
		int counter = 0;
		while (calendar.get(Calendar.YEAR) <= 2000) {
			if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
				counter++;
			}
			calendar.add(Calendar.MONTH, 1);
		}
		System.out.println(counter + " first days of the month in the 20th century fell on a sunday.");
	}
}
